<?php

$mikron->Page->StartBody();
if(!$mikron->Users->Logged())
{
    echo '{{MIKRON_USERFORM}}';
}
else
{
    echo '{{LPULIST}}';
}
$mikron->Page->EndBody();
exit;

/*

    // Страница со списком ЛПУ

    $entityname = "T_LPU";
    $returntext = "Перейти к списку ЛПУ &rarr;";
    $razdel = "Список лечебных учреждений";

    function insert_block_link(&$index, $text, $linkclass)
    {
        $index++;
        ?><a class="<?php echo $linkclass; ?>" href="#" onclick="showhide(spec<?php echo $index; ?>); return false;"><?php echo $text; ?></a><?php
    }

    try
    {
        if(isset($_REQUEST['item']) && is_numeric($_REQUEST['item']))
        {
            $id = (int)$_REQUEST['item'];
            $item = new T_LPU_EXT($id);
            $server = $item->host->value;
            try
            {
                $item->LoadSchedule($server);
            }
            catch(Exception $ex)
            {

            }
            // Вывод информации об ЛПУ
            echo $item->toString();
            ?>
            <br />&nbsp;
            <h1>Расписание специалистов:</h1>
            <blockquote>
            <?php
            $spec_number = 0;
            $tickets_count = 0;
            foreach($item->posts->posts_items as $speciality => $speciality_posts)
            {
                ?>
                <div>
                    <?php insert_block_link($spec_number, $speciality, "link7"); ?>
                    <div class="speclist" id="spec<?php echo $spec_number; ?>" style="display: none;">
                        <?php
                        foreach($speciality_posts as $post)
                        {
                            ?>
                            <div>
                                <div class="frame1">
                                    <?php insert_block_link($spec_number, $post->fio); ?>
                                    <div class="speclist" id="spec<?php echo $spec_number; ?>" style="display: none; ">
                                        <h3>График работы:</h3>
                                          <?php
                                          foreach($post->workdates as $workdate)
                                          {
                                              $date = MikronDateTime::BeautifulDate(strtotime($workdate->date), false);
                                              $timebegin = $workdate->timebegin;
                                              $timeend = $workdate->timeend;
                                              $place = $workdate->place;
                                              $tickets_count += count($workdate->tickets);
                                            ?><div><?php echo "$date &rarr; <font class=\"greytext\">с $timebegin до $timeend,</font> каб. №$place"; ?></div><?php
                                          }
                                          ?>
                                          <a href="/lpu/makerecord/?post=<?php echo $post->id;?>&lpu=<?php echo $item->id;?>">Записаться</a>
                                        </div>
                                    </div>
                                </div>
                            <?php
                        }
                        ?>
                    </div>
                </div>
                <?php
            }
            if($tickets_count < 1)
            {
                ?>
                Расписание не составлено.
                <?php
            }
            ?>
            </blockquote>
            <p><a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>"><?php echo $returntext; ?></a></p>
            <?php
        }
        else
        {
            ?>
            <h1><?php echo $razdel; ?>:</h1>
            <ul class="list1"><?php
            $items = $mikron->Queries->Query($entityname);
            while($item = $items->fetch())
            {
                $id = $item->id;
                $url = $item->toURL();
                $title = $item->title->value;
                echo "<li><a class=\"link2\" href=\"$url\">$title</a></li>";
            }
            ?></ul><?php
        }
    }
    catch(Exception $ex)
    {
       header("Location: 404");
        exit;
    }
?>

<script type="text/JavaScript">
    function showhide(id)
    {
        if(id.style.display == '')
        {
            id.style.display = 'none';
        }
        else
        {
            id.style.display = '';
        }
    }
</script>
<?php */ ?>
<?php $mikron->Page->EndBody(); ?>